﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Intelligent.OTC.Common.UnitOfWork;
using Intelligent.OTC.Domain;
using Intelligent.OTC.Business;
using Intelligent.OTC.Domain.Repositories;
using Intelligent.OTC.Domain.DataModel;
using Intelligent.OTC.WebApi.Core;
using Intelligent.OTC.Common;
using System.Web.OData;

namespace Intelligent.OTC.WebApi.Controllers
{
    public class AgingController : ApiController
    {
        [HttpGet]
        [PagingQueryable]
        public IEnumerable<CustomerAging> Get()
        {
            CustomerService service = SpringFactory.GetObjectImpl<CustomerService>("CustomerService");
            return service.GetCustomerAging().AsQueryable<CustomerAging>();
        }

        [HttpGet]
        [EnableQuery]
        public CustomerDetail Get(int id)
        {
            CustomerService service = SpringFactory.GetObjectImpl<CustomerService>("CustomerService");
            return service.GetCustomerDetail(id);
        }

    }
}